package com.qf.commons.core.exception;

import com.qf.commons.data.result.RCodes;
import lombok.Data;

/**
 * @author YaoJiXing
 * created 2022/8/16 16:33
 */
@Data
//可以被当做异常进行解析
public class ServiceException extends RuntimeException {

    private Integer code;
    private String msg;

    //自定义的业务异常数据格式
    public ServiceException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    //使用枚举类型的业务异常格式
    public ServiceException(RCodes rCodes) {
        this.code = rCodes.getCode();
        this.msg = rCodes.getMsg();
    }


}
